﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WordWonderGame.UI;
using WordWonderGame.UI.Man1;
using WordWonderGame.UI.Man2;
using WordWonderGame.UI.Man3;
using WordWonderGame.UI.Man4;
using System.Media;

namespace WordWonderGame
{
    public partial class MainForm : Form
    {

        FormKhoiDong frmKhoiDong;
        FormMan1 frmMan1;
        FormMan2 frmMan2;
        FormMan3 frmMan3;
        FormMan4 frmMan4;
        FormXongMan1 frmXongMan1;
        FormXongMan2 frmXongMan2;
        FormXongMan3 frmXongMan3;
        FormXongMan4 frmXongMan4;
        
        int DiemMan1;
        int DiemMan2;
        int DiemMan3;
        int DiemMan4;
        
        public MainForm()
        {
            InitializeComponent();
            //frmKhoiDong
            frmKhoiDong = new FormKhoiDong();
            frmKhoiDong.BatDauChoi += new EventHandler(frmKhoiDong_BatDauChoi);
            frmKhoiDong.Dock = DockStyle.Fill;
            frmKhoiDong.TopLevel = false;
            frmKhoiDong.Parent = pnMain;
            frmKhoiDong.Show();
            frmKhoiDong.Visible = false;
            //frmMan1
            frmMan1 = new FormMan1();
            frmMan1.Dock = DockStyle.Fill;
            frmMan1.Parent = pnMain;
            frmMan1.Show();
            frmMan1.Visible = false;
            frmMan1.QuaMan1Roi += new EventHandler(frmMan1_QuaMan1Roi);
            //frmXongMan1
            frmXongMan1 = new FormXongMan1();
            //frmMan2
            frmMan2 = new FormMan2();
            frmMan2.Dock = DockStyle.Fill;
            frmMan2.Parent = pnMain;
            frmMan2.Show();
            frmMan2.Visible = false;
            frmMan2.QuaMan2Roi += new EventHandler(frmMan2_QuaMan2Roi);
            //frmXongMan2
            frmXongMan2 = new FormXongMan2();
            //frmMan3
            frmMan3 = new FormMan3();
            frmMan3.Dock = DockStyle.Fill;
            frmMan3.Parent = pnMain;
            frmMan3.Show();
            frmMan3.Visible = false;
            frmMan3.QuaMan3Roi += new EventHandler(frmMan3_QuaMan3Roi);
            //frmXongMan3
            frmXongMan3 = new FormXongMan3();
            //frmMan4
            frmMan4 = new FormMan4();
            frmMan4.Dock = DockStyle.Fill;
            frmMan4.Parent = pnMain;
            frmMan4.Show();
            frmMan4.Visible = false;
            frmMan4.QuaMan4Roi += new EventHandler(frmMan4_QuaMan4Roi);
            frmXongMan4 = new FormXongMan4();
       
        }

        void frmMan4_QuaMan4Roi(object sender, EventArgs e)
        {
            DiemMan4 = (int)sender;

            frmXongMan4.DiemMan1 = DiemMan1;
            frmXongMan4.DiemMan2 = DiemMan2;
            frmXongMan4.DiemMan3 = DiemMan3;
            frmXongMan4.DiemMan4 = DiemMan4;
            frmXongMan4.ShowDialog();
            frmMan4.Visible = false;
            frmKhoiDong.Visible = true;
            //
            //frmMan1
            frmMan1 = new FormMan1();
            frmMan1.Dock = DockStyle.Fill;
            frmMan1.Parent = pnMain;
            frmMan1.Show();
            frmMan1.Visible = false;
            frmMan1.QuaMan1Roi += new EventHandler(frmMan1_QuaMan1Roi);
            //frmXongMan1
            frmXongMan1 = new FormXongMan1();
            //frmMan2
            frmMan2 = new FormMan2();
            frmMan2.Dock = DockStyle.Fill;
            frmMan2.Parent = pnMain;
            frmMan2.Show();
            frmMan2.Visible = false;
            frmMan2.QuaMan2Roi += new EventHandler(frmMan2_QuaMan2Roi);
            //frmXongMan2
            frmXongMan2 = new FormXongMan2();
            //frmMan3
            frmMan3 = new FormMan3();
            frmMan3.Dock = DockStyle.Fill;
            frmMan3.Parent = pnMain;
            frmMan3.Show();
            frmMan3.Visible = false;
            frmMan3.QuaMan3Roi += new EventHandler(frmMan3_QuaMan3Roi);
            //frmXongMan3
            frmXongMan3 = new FormXongMan3();
            //frmMan4
            frmMan4 = new FormMan4();
            frmMan4.Dock = DockStyle.Fill;
            frmMan4.Parent = pnMain;
            frmMan4.Show();
            frmMan4.Visible = false;
            frmMan4.QuaMan4Roi += new EventHandler(frmMan4_QuaMan4Roi);
            frmXongMan4 = new FormXongMan4();
        }

        void frmMan3_QuaMan3Roi(object sender, EventArgs e)
        {
            DiemMan3 = (int)sender;
            frmXongMan3.DiemMan1 = DiemMan1;
            frmXongMan3.DiemMan2 = DiemMan2;
            frmXongMan3.DiemMan3 = DiemMan3;
            frmXongMan3.ShowDialog();

            frmMan3.Visible = false;
            frmMan4.Visible = true;
        }



        void frmMan2_QuaMan2Roi(object sender, EventArgs e)
        {
            DiemMan2 = (int)sender;
            frmXongMan2.DiemMan1 = DiemMan1;
            frmXongMan2.DiemMan2 = DiemMan2;
            frmXongMan2.ShowDialog();
          // frmXongMan2.Visible = true;
            frmMan2.Visible = false;
            frmMan3.HetGioChoMan3();
            frmMan3.Visible = true;
        }

        void frmMan1_QuaMan1Roi(object sender, EventArgs e)
        {
            DiemMan1 = (int)sender;
            frmXongMan1.DiemMan1 = DiemMan1;
            frmXongMan1.ShowDialog();
            frmMan1.Visible = false;
            frmMan2.Visible = true;
        }

        void frmKhoiDong_BatDauChoi(object sender, EventArgs e)
        {
            frmKhoiDong.Visible = false;
            frmMan1.Visible = true;
        }

        private void MainForm_Load(object sender, EventArgs e)
        {
           
            frmKhoiDong.Visible = true;
        }
    }
}
